<template>
  <div id="announcement">
    <div class="notice">
      <!-- 公告展示 -->
      <div class="right-notice">
        <b-card v-for="(announ,index) in announcements" :key="index">
          <div class="num-border">
            <div class="title">
              <span v-text="announ.title">活动信息股份公司的公司的股份公司的</span>
            </div>
          </div>
          <p>
            <span class="noticeTime" v-text="announ.updateTime">2020-06-11 11:20</span>
          </p>
          <b-card-text v-html="announ.content">
            活动信息股份公司的公司的股份公司的
            公司规定非官方大哥风格的风格发的发的航空飞机好
            的会计规范和价格肯定会给开的价格好地方估计电话给看对方觉到活动信息股份公司的公司的股份公司的
            公司规定非官方大哥风格的风格发的发的航空飞机好
            的会计规范和价格肯定会给开的价格好地方估计电话给看对方感觉到
          </b-card-text>
        </b-card>
      </div>
      <!-- 分页 -->
      <div class="notice-page">
        <!-- <b-pagination v-model="currentPage1" pills :total-rows="rows1" size="sm"></b-pagination> -->
        <el-pagination
          layout="prev, pager, next"
          @current-change="skipPage"
          :total="total"
          :page-size="pageSize"
          :current-page="pageNum"
        ></el-pagination>
        <!-- 分页区域 end-->
      </div>
      <!-- 分页end -->
      <!-- 公告展示end -->
    </div>
  </div>
</template>
<script>
export default {
  name: "index",
  data() {
    return {
      // 分页
      total: 0,
      pageNum: 1,
      pageSize: 5,
      // 分页end

      //禁止modal
      modal: false,
      announcements: []
    };
  },
  props: ["announcementList"],
  created() {
    console.log(this.announcementList);

    this.getAnnouncements();
  },
  methods: {
    // 根据页码跳转
    skipPage: function(pageNum) {
      this.$get(
        this.$urlPath.notice +
          "notice/collection/noticeCollection/" +
          pageNum +
          "/" +
          this.pageSize +
          "/" +
          this.announcementList.collectionId
      )
        .then(resp => {
          console.log("resp");
          console.log(resp.data);
          this.announcements = resp.data.list;
          this.total = resp.data.total;
          console.log(this.total);
        })
        .catch(error => {
          console.log(error);
        });
    },
    getAnnouncements() {
      this.announcements = this.announcementList.announcements.data.list;
      this.total = this.announcementList.announcements.data.total;
    }
  }
};
</script>
<style lang="less">
@import "../assets/less/rightSide.less";
</style>